package com.course_design.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.course_design.dao.SchoolMapper;
import com.course_design.entity.School;
import com.course_design.entity.SchoolExample;

@Service
public class SchoolSerevice {
	@Autowired
	private SchoolMapper schoolMapper;
	public List<School> queryAllSchool() {
		return schoolMapper.selectByExample(null);
	}
	public boolean addSchool(School school) {
		schoolMapper.insert(school);
		return true;
	}
	public boolean querySchoolByCode(String code) {
		SchoolExample example=new SchoolExample();
		SchoolExample.Criteria criteria=example.createCriteria();
		criteria.andCodeEqualTo(code);
		if(schoolMapper.selectByExample(example).size()!=0) {
			return true;
		}else {
			return false;
		}
	}

}
